<?php

require '../../../zb_system/function/c_system_base.php';
require '../../../zb_system/function/c_system_admin.php';

$zbp->Load();
$action = 'root';
$appid = 'acmeContract';
if (!$zbp->CheckRights($action)) {
    $zbp->ShowError(6);
    die();
}
if (!$zbp->CheckPlugin($appid)) {
    $zbp->ShowError(48);
    die();
}
// 图片logo
if ($_GET['type'] == 'logo') {
    global $zbp;
    foreach ($_FILES as $key => $value) {
        if (!strpos($key, '_php')) {
            if (is_uploaded_file($_FILES[$key]['tmp_name'])) {
                $tmp_name = $_FILES[$key]['tmp_name'];
                $name = $_FILES[$key]['name'];
                @move_uploaded_file($_FILES[$key]['tmp_name'], $zbp->usersdir.'theme/'.$appid.'/style/images/logo.png');
            }
        }
    }
    $zbp->SetHint('good', '上传成功');
    Redirect('./main.php?act=config');
}

// 轮播图
if ($_GET['type'] == 'banner1') {
    global $zbp;
    foreach ($_FILES as $key => $value) {
        if (!strpos($key, '_php')) {
            if (is_uploaded_file($_FILES[$key]['tmp_name'])) {
                $tmp_name = $_FILES[$key]['tmp_name'];
                $name = $_FILES[$key]['name'];
                @move_uploaded_file($_FILES[$key]['tmp_name'], $zbp->usersdir.'theme/'.$appid.'/style/images/banner1.jpg');
            }
        }
    }
    $zbp->SetHint('good', '上传成功');
    Redirect('./main.php?act=config');
}

if ($_GET['type'] == 'banner2') {
    global $zbp;
    foreach ($_FILES as $key => $value) {
        if (!strpos($key, '_php')) {
            if (is_uploaded_file($_FILES[$key]['tmp_name'])) {
                $tmp_name = $_FILES[$key]['tmp_name'];
                $name = $_FILES[$key]['name'];
                @move_uploaded_file($_FILES[$key]['tmp_name'], $zbp->usersdir.'theme/'.$appid.'/style/images/banner2.jpg');
            }
        }
    }
    $zbp->SetHint('good', '上传成功');
    Redirect('./main.php?act=config');
}

if ($_GET['type'] == 'banner3') {
    global $zbp;
    foreach ($_FILES as $key => $value) {
        if (!strpos($key, '_php')) {
            if (is_uploaded_file($_FILES[$key]['tmp_name'])) {
                $tmp_name = $_FILES[$key]['tmp_name'];
                $name = $_FILES[$key]['name'];
                @move_uploaded_file($_FILES[$key]['tmp_name'], $zbp->usersdir.'theme/'.$appid.'/style/images/banner3.jpg');
            }
        }
    }
    $zbp->SetHint('good', '上传成功');
    Redirect('./main.php?act=config');
}

// 站长信息
if ($_GET['type'] == 'individualModule') {
    global $zbp;
    foreach ($_FILES as $key => $value) {
        if (!strpos($key, '_php')) {
            if (is_uploaded_file($_FILES[$key]['tmp_name'])) {
                $tmp_name = $_FILES[$key]['tmp_name'];
                $name = $_FILES[$key]['name'];
                @move_uploaded_file($_FILES[$key]['tmp_name'], $zbp->usersdir.'theme/'.$appid.'/style/images/individualModule.jpg');
            }
        }
    }
    $zbp->SetHint('good', '上传成功');
    Redirect('./main.php?act=config');
}
if ($_GET['type'] == 'tx') {
    global $zbp;
    foreach ($_FILES as $key => $value) {
        if (!strpos($key, '_php')) {
            if (is_uploaded_file($_FILES[$key]['tmp_name'])) {
                $tmp_name = $_FILES[$key]['tmp_name'];
                $name = $_FILES[$key]['name'];
                @move_uploaded_file($_FILES[$key]['tmp_name'], $zbp->usersdir.'theme/'.$appid.'/style/images/tx.jpg');
            }
        }
    }
    $zbp->SetHint('good', '上传成功');
    Redirect('./main.php?act=config');
}
